let fs = require('fs');
let buf = '';

process.stdin.on('readable', function() {
    let chunk = process.stdin.read();
    if (chunk) buf += chunk.toString();
});

process.stdin.on('end', function() {
    let [n, m] = buf.split(" ").map((x)=>{return parseInt(x);});
    let vv= [];
    for (let i = 0; i < n; ++i) {
        vv.push([]);
        for (let j = 0; j < m; ++j) {
            vv[i].push(0);
        }
    }
    let ns = [[0, 1], [1, 0], [0, -1], [-1, 0]];
    let flag = 0, cnt = 1;
    
    let x = 0, y = 0;
    while (true) {
        vv[x][y] = cnt++;
        let nx = x + ns[flag][0], ny = y + ns[flag][1];
        if (nx >= n || nx < 0 || ny >= m || ny < 0 || vv[nx][ny] !== 0) flag = (flag + 1) % 4;
        nx = x + ns[flag][0], ny = y + ns[flag][1];
        if (vv[nx][ny] !== 0) break;
        x = nx, y = ny;
    }
    for (let i = 0; i < n; ++i) {
        let s = "";
        for (let j = 0; j < m; ++j) {
            s += `${vv[i][j]} `;
        }
        console.log(s);
    }
});